#include <graphics/camera.h>

namespace yam3d
{
namespace graphics
{

Camera::Camera()
    : core::Object(__FUNCTION__)
{
}


Camera::~Camera()
{
}

void Camera::setPerspective(float angle, float aspect, float nearPlane, float farPlane )
{
    m_angle      = angle;
    m_aspect     = aspect;
    m_nearPlane  = nearPlane;
    m_farPlane   = farPlane;

    m_projection.setToIdentity();
    m_projection.perspective(m_angle,m_aspect,m_nearPlane,m_farPlane);
}

void Camera::setClipPlanes( float nearPlane, float farPlane )
{
    m_nearPlane  = nearPlane;
    m_farPlane   = farPlane;

    m_projection.setToIdentity();
    m_projection.perspective(m_angle,m_aspect,m_nearPlane,m_farPlane);
}

void Camera::setFOV( float angle, float aspect )
{
    m_angle     = angle;
    m_aspect    = aspect;

    m_projection.setToIdentity();
    m_projection.perspective(m_angle,m_aspect,m_nearPlane,m_farPlane);
}

float Camera::getNearPlane() const
{
    return m_nearPlane;
}

float Camera::getFarPlane() const
{
    return m_farPlane;
}

float Camera::getAngle() const
{
    return m_angle;
}

float Camera::getAspectRatio() const
{
    return m_aspect;
}

const math::mat4& Camera::getProjection() const
{
    return m_projection;
}

/*
math::mat4 Camera::getView() const
{
    return getTransform();
}

math::mat4 Camera::getViewProj() const
{
    return getProjection() * getView();
}
*/
}
}
